package wsi.task.map;

import java.util.List;
import java.util.Map;

import org.rygh.core.model.common.MapList;
import org.rygh.core.model.common.StringSet;

import wsi.dataguide.tree.WSXmlLeaf;
import wsi.subgraph.tree.EntityBranch;

public class MapCandidateCache {

	private final MapList<StringSet, EntityBranch> cacheMap = new MapList<>();

	public MapCandidateCache() {

	}

	public boolean contains(StringSet ss) {
		return cacheMap.containsKey(ss);
	}

	public List<EntityBranch> get(StringSet ss) {
		return cacheMap.get(ss);
	}

	public Map<StringSet, List<EntityBranch>> getCacheMap() {
		return cacheMap.getMap();
	}

	public StringSet getStringSetKey(WSXmlLeaf source, WSXmlLeaf dest) {
		StringSet ss = new StringSet();
		ss.add(source.getValue().getValue());
		ss.add(dest.getValue().getValue());

		return ss;
	}

	public void put(StringSet key, EntityBranch branch) {
		cacheMap.put(key, branch);
	}

}
